<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="styles/css/global.css">
<script type="text/javascript">
	var table= document.getElementById("addFormTable");
	function addSchool(){
	var table= document.getElementById("addFormTable");
		var   newrow   =   table.insertRow(3);
		var   newcell1   =   newrow.insertCell();  
		newcell1.innerHTML=div1.innerHTML;
		var   newcell2   =   newrow.insertCell();  
		newcell2.innerHTML=div2.innerHTML;
	}
	function deleteSchool(src){
	var table= document.getElementById("addFormTable");
  		var   i=table.rows.length;   
  		while(i--){
  		//	 alert(i);   
 			 if(src==table.rows[i]){   
 			//	 alert("就是这行----"+   i);   
 			 	table.deleteRow(i);   
  			}   
  		}  
	}
	var div7Show=false;
	function changeRow(){
	//	alert(div7Show);
		var divShow=document.getElementById("div7");
	//	alert(divShow);
		var type = document.getElementById("guest.signType");
		var selectValue = type.options[type.selectedIndex].value;
		if(selectValue!=0 && div7Show == false){
			div7Show=true;
			var table= document.getElementById("addFormTable");
			var   newrow   =   table.insertRow(table.rows.length-3);
			var   newcell1   =   newrow.insertCell();  
			newcell1.innerHTML=div7.innerHTML;
			var   newcell2   =   newrow.insertCell();  
			newcell2.innerHTML=div8.innerHTML;
		}if(selectValue==0 && div7Show == true){
			var table= document.getElementById("addFormTable");
			table.deleteRow(table.rows.length-4);
			div7Show=false;
		}
	}
</script>
<script type="text/javascript">
	function submitCheck(){
		guestForm.submit();
	}
</script>
</head>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="localTdBg">
					当前位置：	
					
						联系人管理 -- 添加联系人
					
				</td>
			</tr>
			
</table>
<my:dpimporter/>
<body>
<html:form method="post"  action="guest.do?method=doCreateGuest">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" id="addFormTable">
	<tr>
		<td width="25%" id="addFormTableL">名称</td>
		<td width="75%" id="addFormTableR"><input name="guest.name" type="text" value="${guest.name}"></td>
	</tr>
	<tr>
		<td width="25%" id="addFormTableL">电话</td>
		<td width="75%" id="addFormTableR"><input name="guest.tel" type="text" value="${guest.tel}" ></td>
	</tr>
	<tr>
		<td width="25%" id="addFormTableL">学校</td>
		<td width="75%" id="addFormTableR">
			<select name="guest.schoolId" value="${guest.schoolId}">
				<c:forEach var="school" items="${schoolList}">
					<option value="${school.sid }">${school.name}</option>
				</c:forEach>
			</select>
			<img src="styles/image/add.GIF" onclick="javascript:addSchool();">
		</td>
	</tr>
	<tr>
		<td width="25%" id="addFormTableL">课程类别</td>
		<td width="75%" id="addFormTableR">
			<select name="guest.lessonTypeId" value="${guest.lessonTypeId}">
				<c:forEach var="lessonType" items="${lessonTypeList}">
					<option value="${lessonType.ltid }">${lessonType.name }</option>
				</c:forEach>
			</select>
		</td>
	</tr>
	<tr>
		<td width="25%" id="addFormTableL">课程</td>
		<td width="75%" id="addFormTableR"><input name="guest.lesson" type="text" value="${guest.lesson}" ></td>
	</tr>
	<tr>
		<td width="25%" id="addFormTableL">开课时间</td>
		<td width="75%" id="addFormTableR"><my:dp elementid="StartClassTimeId" name="guest.startClassTime" value="${guest.startClassTime}" canNull="true" format="%Y-%m-%d %H:%M:%S" showTime="true" style="" styleClass="formInput" ></my:dp></td>
	</tr>	
	<tr>
		<td width="25%" id="addFormTableL">报名与否</td>
		<td width="75%" >
		<select name="guest.signType" id="guest.signType" value="${guest.signType}" onChange="changeRow()" >
					<option value="0">已报名</option>
					<option value="1" >未报名</option>
					<option value="2" >无意向</option>
			</select>
		</td>
	</tr>		
	<tr>
		<td width="25%">备注</td>
		<td width="75%"></td>
	</tr>
	<tr>	
		<td width="25%" id="addFormTableL"></td>
		<!-- 
		<input name="guest.remark" type="" value="${guest.remark}">
		 -->
		 <td width="75%" id="addFormTableR">
		 <textarea rows="3" cols="20" name="guest.remark" >${guest.remark}</textarea>
		</td>
	</tr>
 	<tr>
 		<td width="25%">
						&nbsp;
		</td>
 		<td width="75%">
		 <input name="Submit" type="button" class="formSubmit" value="提交" onclick="javascript:submitCheck()">
         <input onclick="lessonTypeForm.reset();" type="reset" class="formSubmit" value="重置">
		</td>
	</tr>
</table>
<div   id="div1"   style="display:none   ">
		<td width="25%" id="addFormTableL"></td>
</div>
<div   id="div2"   style="display:none   ">
		<td width="75%" id="addFormTableR">
			<select name="guest.otherSchoolId">
				<c:forEach var="school" items="${schoolList}">
					<option value="${school.sid }">${school.name}</option>
				</c:forEach>
			</select>
			<img src="styles/image/add.GIF" onclick="addSchool();">
			<img src="styles/image/reduce.GIF" onclick="deleteSchool(this.parentElement.parentElement);">
		</td>
</div>
<div   id="div7"   style="display:none   ">
		<table  align="left">
			<tr>
				<td width="25%" id="addFormTableL">重要回访时间</td>
			</tr>
			<tr>
				<td width="25%" id="addFormTableL">重要度</td>
			</tr>
		</table>
</div>
<div   id="div8"   style="display:none   ">
	<table align="left">
		<tr>
			<td width="75%" id="addFormTableL"><my:dp elementid="returnVisitTimeId" name="guest.returnVisitTime" value="" canNull="true" format="%Y-%m-%d %H:%M:%S" showTime="true" style="" styleClass="formInput" ></my:dp></td>	
		<tr>
		<tr>
						<td width="25%" id="addFormTableL" title="星级越高，重要度越高">
		<select name="guest.importantType">
				<%
					for(int i=1;i<6;i++){
				%>
					<option value="<%=i %>"><%=i %>星</option>
				<%		
					}
				%>
		</select>
		</td>
		</tr>
	</table>
</div>
</html:form>
</body>
</html>